package com.aynu.webshop.web.service.impl;

import java.util.List;

import javax.annotation.Resource;

import org.apache.poi.hssf.model.Model;
import org.springframework.stereotype.Service;

import com.aynu.webshop.core.generic.GenericDao;
import com.aynu.webshop.core.generic.GenericServiceImpl;
import com.aynu.webshop.web.dao.UserMapper;
import com.aynu.webshop.web.model.User;
import com.aynu.webshop.web.service.UserService;

@Service
public class UserSerivceImpl extends GenericServiceImpl<User, Integer> implements UserService {

	@Resource
	private UserMapper userMapper;
	
	@Override
	public int insert(User model) {
		// TODO Auto-generated method stub
		return userMapper.insertSelective(model);
	}

	@Override
	public int update(User model) {
		// TODO Auto-generated method stub
		return userMapper.updateByPrimaryKeySelective(model);
	}

	@Override
	public int delete(Integer id) {
		// TODO Auto-generated method stub
		return userMapper.deleteByPrimaryKey(id);
	}

	@Override
	public User selectById(Integer id) {
		// TODO Auto-generated method stub
		return userMapper.selectByPrimaryKey(id);
	}

	@Override
	public User selectOne() {
		// TODO Auto-generated method stub
		return null;
	}

	@Override
	public List<User> selectList() {
		// TODO Auto-generated method stub
		return userMapper.findAll();
	}

	@Override
	public GenericDao<User, Integer> getDao() {
		// TODO Auto-generated method stub
		return userMapper;
	}

	@Override
	public User findByUname(String getuName) {
		// TODO Auto-generated method stub
		return userMapper.selectByName(getuName);
	}

}
